#!/usr/bin/env python
# -*- coding: utf-8 -*-

'''
Created 2011/12/01
@autor: Sérgio Santos
'''
import csv
import sqlite3
import Tkinter
import tkMessageBox
import tkSimpleDialog

class Teacher_Educa_Stab_Year():
		# conta nº de prof por estabelecimento e por ano		
		def __init__(self):
			
			conexao = sqlite3.connect("treta.db")
			c = conexao.cursor()

			root = Tkinter.Tk()
			root.withdraw()
	
			year = tkSimpleDialog.askstring('Year','Qual o ano lectivo?')
			establishment = tkSimpleDialog.askstring('Establishment','Qual o Estabelecimento de ensino?')
	
			c.execute("SELECT count(*) FROM PROF WHERE ano_lectivo = '"+ str(year)+ "' AND nome_estabelecimento = '"+establishment+"' ")
			lista = []
			for row in c.fetchall():
				lista.append(row)
				pass	
		
			show_result_soup2 =tkMessageBox.showwarning(title='Estatistica',
			message='Existe  '+str(lista[0])+' professores')
			root.destroy()

			conexao.commit() 
